#include "tcpclientsocket.h"

TcpClientSocket::TcpClientSocket(QObject *parent) : QTcpSocket(parent)
{
    //客户端有消息传进来时会触发信号readyRead
    connect(this,SIGNAL(readyRead()),this,SLOT(slotReceiveDate()));
    //客户端断开连接时会触发信号disconnected
    connect(this,SIGNAL(disconnected()),this,SLOT(slotClientDisconnected()));
}

void TcpClientSocket::slotReceiveDate()
{

    QByteArray baArray=readAll();
    QString sMsg=baArray;
    emit sigUpdateSever(sMsg);
}

void TcpClientSocket::slotClientDisconnected()
{
    emit sigClientDisconnect(this->socketDescriptor());
}
